package main

import (
	"gateway/config"
	"gateway/core"
	"os"
	"os/signal"
	l "util/log"
)

func main() {
	c := config.CreateConfig()
	if !c.Load() {
		l.LogError("load config failed")
		return
	}

	ch := make(chan bool)
	g := core.GetGate()
	g.Start(c, ch)

	s := make(chan os.Signal, 1)
	signal.Notify(s, os.Interrupt)
	go func() {
		select {
		case <-s:
			core.ServiceQuit()
			l.TraceInfo("game", "stop service")
		}
	}()

	<-ch
}
